package edu.hitsz.aircraft;

import edu.hitsz.application.Main;
import edu.hitsz.prop.*;

import java.util.LinkedList;
import java.util.List;
import java.util.Random;

/**
 * 精英敌机
 * 可以射击和掉落物品
 *
 * @author 陈柏居
 */
public class EliteEnemy extends AbstractEnemy {

    public EliteEnemy(int locationX, int locationY, int speedX, int speedY, int hp, int shootNum) {
        super(locationX, locationY, speedX, speedY, hp, shootNum, 10, 1);
    }

    @Override
    public void forward() {
        super.forward();
        // 判定 y 轴向下飞行出界
        if (locationY >= Main.WINDOW_HEIGHT ) {
            vanish();
        }
    }

    @Override
    public List<AbstractProp> enemyVanish() {
        List<AbstractProp> props = super.enemyVanish();
        // Blood Bomb Bullet三种情况等可能
        Random random = new Random();
        PropFactory propFactory;
        switch (random.nextInt(4)) {
            case 0:
                propFactory = new BloodPropFactory();
                break;
            case 1:
                propFactory = new BombPropFactory();
                break;
            case 2:
                propFactory = new BulletPropFactory();
                break;
            default:
                return props;
        }
        props.add(propFactory.createProp(this));
        return props;
    }
}
